/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author taticay
 */
@Entity
@Table(name = "in_catalog")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InCatalog.findAll", query = "SELECT i FROM InCatalog i"),
    @NamedQuery(name = "InCatalog.findByIdCatalog", query = "SELECT i FROM InCatalog i WHERE i.inCatalogPK.idCatalog = :idCatalog and i.inCatalogPK.idClass = :idClass and i.inCatalogPK.idLine = :idLine"),
    @NamedQuery(name = "InCatalog.findByIdClass", query = "SELECT i FROM InCatalog i WHERE i.inCatalogPK.idClass = :idClass"),
    @NamedQuery(name = "InCatalog.findByIdLine", query = "SELECT i FROM InCatalog i WHERE i.inCatalogPK.idLine = :idLine"),
    @NamedQuery(name = "InCatalog.findByIdBrand", query = "SELECT i FROM InCatalog i WHERE i.inCatalogPK.idBrand = :idBrand"),
    @NamedQuery(name = "InCatalog.findByIdGlobalCode", query = "SELECT i FROM InCatalog i WHERE i.idGlobalCode = :idGlobalCode"),
    @NamedQuery(name = "InCatalog.findByCharacters", query = "SELECT i FROM InCatalog i WHERE i.characters = :characters"),
    @NamedQuery(name = "InCatalog.findByDescription", query = "SELECT i FROM InCatalog i WHERE i.description = :description"),
    @NamedQuery(name = "InCatalog.findByModelName", query = "SELECT i FROM InCatalog i WHERE i.modelName = :modelName"),
    @NamedQuery(name = "InCatalog.findByModelYear", query = "SELECT i FROM InCatalog i WHERE i.modelYear = :modelYear"),
    @NamedQuery(name = "InCatalog.findByStockMin", query = "SELECT i FROM InCatalog i WHERE i.stockMin = :stockMin"),
    @NamedQuery(name = "InCatalog.findByStockMax", query = "SELECT i FROM InCatalog i WHERE i.stockMax = :stockMax"),
    @NamedQuery(name = "InCatalog.findByHasTax", query = "SELECT i FROM InCatalog i WHERE i.hasTax = :hasTax"),
    @NamedQuery(name = "InCatalog.findByIdTypeTax", query = "SELECT i FROM InCatalog i WHERE i.idTypeTax = :idTypeTax"),
    @NamedQuery(name = "InCatalog.findByStatus", query = "SELECT i FROM InCatalog i WHERE i.status = :status")})
public class InCatalog implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected InCatalogPK inCatalogPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_global_code")
    private int idGlobalCode;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 4)
    @Column(name = "characters")
    private String characters;
    @Size(max = 500)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "model_name")
    private String modelName;
    @Basic(optional = false)
    @NotNull
    @Column(name = "model_year")
    private int modelYear;
    @Size(max = 500)
    @Column(name = "link")
    private String link;
    @Column(name = "stock_min")
    private Integer stockMin;
    @Column(name = "stock_max")
    private Integer stockMax;
    @Basic(optional = false)
    @NotNull
    @Column(name = "has_tax")
    private boolean hasTax;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @OneToOne
    @JoinColumn(name="id_type_tax")
    private TypeTax idTypeTax;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private boolean status;

    public InCatalog() {
    }

    public InCatalog(InCatalogPK inCatalogPK) {
        this.inCatalogPK = inCatalogPK;
    }

    public InCatalog(InCatalogPK inCatalogPK, int idGlobalCode, String characters, String modelName, int modelYear, boolean hasTax, boolean status) {
        this.inCatalogPK = inCatalogPK;
        this.idGlobalCode = idGlobalCode;
        this.characters = characters;
        this.modelName = modelName;
        this.modelYear = modelYear;
        this.hasTax = hasTax;
        this.status = status;
    }

    public InCatalog(int idCatalog, int idClass, int idLine, int idBrand) {
        this.inCatalogPK = new InCatalogPK(idCatalog, idClass, idLine, idBrand);
    }

    public InCatalogPK getInCatalogPK() {
        return inCatalogPK;
    }

    public void setInCatalogPK(InCatalogPK inCatalogPK) {
        this.inCatalogPK = inCatalogPK;
    }

    public int getIdGlobalCode() {
        return idGlobalCode;
    }

    public void setIdGlobalCode(int idGlobalCode) {
        this.idGlobalCode = idGlobalCode;
    }

    public String getCharacters() {
        return characters;
    }

    public void setCharacters(String characters) {
        this.characters = characters;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    public int getModelYear() {
        return modelYear;
    }

    public void setModelYear(int modelYear) {
        this.modelYear = modelYear;
    }
    
      public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public Integer getStockMin() {
        return stockMin;
    }

    public void setStockMin(Integer stockMin) {
        this.stockMin = stockMin;
    }

    public Integer getStockMax() {
        return stockMax;
    }

    public void setStockMax(Integer stockMax) {
        this.stockMax = stockMax;
    }

    public boolean getHasTax() {
        return hasTax;
    }

    public void setHasTax(boolean hasTax) {
        this.hasTax = hasTax;
    }

    public TypeTax getTaxPer() {
        return idTypeTax;
    }

    public void setTaxPer(TypeTax idTypeTax) {
        this.idTypeTax = idTypeTax;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (inCatalogPK != null ? inCatalogPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InCatalog)) {
            return false;
        }
        InCatalog other = (InCatalog) object;
        if ((this.inCatalogPK == null && other.inCatalogPK != null) || (this.inCatalogPK != null && !this.inCatalogPK.equals(other.inCatalogPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.InCatalog[ inCatalogPK=" + inCatalogPK + " ]";
    }
    
}
